home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 1619 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: ar.ar.com.au!not-for-mail
  2. From: storm@ar.ar.com.au (Storm)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: PPC compilers
  5. Date: 20 Jan 1996 07:34:36 +1100
  6. Organization: I need to put my ORGANIZATION here.
  7. Distribution: world
  8. Message-ID: <4dov8s$rc5@ar.ar.com.au>
  9. References: <john.hendrikx.40ka@grafix.xs4all.nl> <MQAQx*XOe@yaps.rhein.de> <OWhVx*42f@yaps.rhein.de> <4cuhng$dmn@maureen.teleport.com> <jasonb.821247870@cs.uwa.edu.au> <4d359i$ii7$1@sydney.DIALix.oz.au> <4d42gg$i2p@ra.ibr.cs.tu-bs.de>
  10. NNTP-Posting-Host: ar.ar.com.au
  11. X-Newsreader: TIN [UNIX 1.3 941216BETA PL0]
  12.  
  13. Lars Duening (duening@ibr.cs.tu-bs.de) wrote:
  14. : accolyte@sydney.DIALix.oz.au (Troy Till) writes:
  15. : >Bear with me here, 'cause I don't know the second thing about C..
  16. : >
  17. : >can you do something to the equivalent of:
  18. : >
  19. : >  addx.l d0,d1
  20. : >  move.w d1,d2
  21. : >
  22. : >Which is treating d1 as a long word, then a word. How would you implement 
  23. : >this in C?
  24.  
  25. : I'd try (int16)((int32)a+(int32)b) with int16 and int32 appropriately
  26. : defined.
  27.  
  28. : But the question is: why should I treat d1 as long in the addition,
  29. : when just the lower word is used afterwards?
  30.  
  31. To do fast 16:16 bit fixed point maths (ie for bitmap scaling). You have the
  32. fraction in the  high word and the integer part in the low word. Because of
  33. the addx, every time the fraction wraps around, the X bit is set and next
  34. add, the integer bit is incremented.
  35.  
  36. Of course you only wish to use the integer bit so only the low word of d1
  37. is moved to d2.
  38.  
  39. --                  ______________________________
  40.                     \_/ "\/\/\__"\/ "\/ "\/\__"\_/ 
  41. Storm / Cydonia      / / / / / / / / / / / / ' /       Packing class
  42.                     / /\/>  / / / / / / / / / /__     & kicking arse!
  43.     (coder)         \__/ \_/\__/\__/\/\/\/\/\/ \/
  44.